package com.aischool.webapp.family;

import com.aischool.routes.RouteMapping;
import com.aischool.service.AiStudentService;
import com.aischool.service.AiTeacherService;
import com.aischool.utils.JsonCodeEnum;
import com.aischool.utils.JsonResult;
import com.jfinal.aop.Inject;

@RouteMapping(url = "/front/family/students")
public class StudentsController extends BaseFamilyController {

	@Inject
	AiTeacherService aiTeacherService;
	@Inject
	AiStudentService aiStudentService;
	
	/**
	 * 首页
	 */
	public void index() {
		render(view_path + "/students.html");
	}
	
	/**
	 * 获取班级成员
	 */
	public void getMembers() {
		// 结果类
		JsonResult jr = new JsonResult();
		
		// 获取参数
		int login_class_id = this.getAttrForInt("login_class_id");		

		// 获取分页
		Object teacherData = aiTeacherService.getTeachers(login_class_id);
		jr.setDicKV("list_teachers", teacherData);
		Object studentsData = aiStudentService.getStudents(login_class_id);
		jr.setDicKV("list_students", studentsData);
		
		jr.setEnum(JsonCodeEnum.Success);
		renderJson(jr.Dic);
	}
}
